package com.lkm.market2_0.help;

import com.lkm.javatool.StringHelp;
import com.lkm.market2_0.ExpandConfig;

import java.text.SimpleDateFormat;




public class UIP {

    public static boolean isPrint(){
        return !true;
    }

    static StringBuilder stringBuilder=new StringBuilder();

    public static synchronized void clear(){
        stringBuilder.delete(0,stringBuilder.length());

        p("清除控制台","");
    }

    public static String printMac=null;
    

    public static synchronized void p(String s,String steelyardMac){

        
        if(stringBuilder.length()>10000){
            clear();
        }

        if(!StringHelp.isEmpty(steelyardMac)){
            if(!StringHelp.isEmpty(printMac)) {
                
                if (!steelyardMac.equals(printMac)) {
                    return;
                }
            }

        }

        String createTime =  new SimpleDateFormat("HH:mm   :ss.SSS").format(System.currentTimeMillis());//(ServerTimeSync.getInstance().getServerCurTime());
        if(s.startsWith("CMD心跳")){
            s="     💖💖"+s;
        }else if(s.startsWith("CMD称重")){
            s="     🐘🐘️"+s;
        }else if(s.startsWith("UP")){
            s="     💪💪️"+s;
        }else if(s.startsWith("CMD打印")){
            s="     📚📚"+s;
        }



        else if(s.startsWith("Send")){
            s="     ✨✨"+s;
        }

        stringBuilder.append("\n—————————"+steelyardMac+"———"+createTime+"—————————\n"+s);

        
        ExpandConfig.instance.showLogInUI(stringBuilder.toString());

//            MainActivity.mainActivity.runOnUiThread(new Runnable() {



//                        MainActivity.tv_logs.setText(stringBuilder.toString());









    }
}
